/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N550;
import queenb.web.inteface.N550Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class N550Store extends N550 implements N550Inf {

    @Override
    public List<N550> getListN550All(int pnFH000, int pnFH200, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_N550, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, N550.class);
        } catch (SQLException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateN550(int pnPN550,
            String pvNV551, String pvNV552, Date pdND553,int pnNN554,
            int pnFH000, int pnFH200, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_N550, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPN550),
                    new Param(OracleTypes.CHAR, pvNV551),
                    new Param(OracleTypes.CHAR, pvNV552),
                    new Param(OracleTypes.DATE, pdND553),
                    new Param(OracleTypes.INTEGER, pnNN554),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, N550.class);
        } catch (SQLException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int deleteN550(int pnPN550, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_N550, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN550),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, N550.class);
        } catch (SQLException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
    @Override
    public List<N550> findAllN550ForCombo(int pnFH000, int pnFH200,int pnNN554, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_COMBN550, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnFH000),
                       new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnNN554),
                       new Param(OracleTypes.CHAR, pvLOGIN)
                   });
           return super.find(dataStatement, N550.class);
        } catch (SQLException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N550Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
